/**
 * Created by baidm in 2022/6/4 on 18:53
 */
import {ref} from "vue";
import {useRouter} from "vue-router";
import {menu} from "@/type/demo.type.ts"
import {openWindow} from "@/hooks/common/useCommon.hook.ts"
import l7DemoConst from "@/const/l7DemoConst.ts"
import L7DemoConst from "@/const/l7DemoConst.ts";

export default function () {
    const router = useRouter()

    const demoList = ref<menu []>([
        {name: "[初始化] mapbox地图", id: l7DemoConst.MAP_INIT_MAPBOX},
        {name: "[初始化] 高德地图", id: L7DemoConst.MAP_INIT_GAODE},
        {name: "[点图层] 添加默认marker", id: L7DemoConst.MAP_ADD_MARKER},
        {name: "[点图层] 添加气泡地图（点击拾取）", id: L7DemoConst.MAP_ADD_BUBBLE_1},
        {name: "[点图层] 添加气泡地图（形状映射）", id: L7DemoConst.MAP_ADD_BUBBLE_2},
        {name: "[点图层] 添加气泡地图", id: L7DemoConst.MAP_ADD_BUBBLE_3},
        {name: "[点图层] 添加气泡地图（动画）", id: L7DemoConst.MAP_ADD_BUBBLE_4},
        {name: "[点图层] 添加文本标注（点数据标注）", id: L7DemoConst.MAP_ADD_TEXT_1},
        {name: "[点图层] 添加文本标注（面数据标注）", id: L7DemoConst.MAP_ADD_TEXT_2},
        {name: "[点图层] 添加文本标注（图标标注）", id: L7DemoConst.MAP_ADD_TEXT_3},
        {name: "[点图层] 添加文本标注（天气图标标注）", id: L7DemoConst.MAP_ADD_TEXT_4},
        {name: "[点图层] 添加文本标注（文本动态偏移）", id: L7DemoConst.MAP_ADD_TEXT_5},
        {name: "[点图层] 添加文本标注（气温图标标注）", id: L7DemoConst.MAP_ADD_TEXT_6},
        {name: "[点图层] 添加散点地图", id: L7DemoConst.MAP_ADD_SCATTER_1},
        {name: "[点图层] 添加散点地图（动态散点）", id: L7DemoConst.MAP_ADD_SCATTER_2},
        {name: "[点图层] 添加散点地图（样式映射散点）", id: L7DemoConst.MAP_ADD_SCATTER_3},
        {name: "[点图层] 添加散点地图（模糊点）", id: L7DemoConst.MAP_ADD_SCATTER_4},
        {name: "[点图层] 添加散点地图（水波散点）", id: L7DemoConst.MAP_ADD_SCATTER_5},
        {name: "[点图层] 添加散点地图（雷达图）", id: L7DemoConst.MAP_ADD_SCATTER_6},
        {name: "[面图层] 添加layer", id: L7DemoConst.MAP_ADD_LAYER},
        {name: "[控件类] 添加mapbox control", id: L7DemoConst.MAP_ADD_CONTROL_WITH_MAPBOX},
        {name: "[控件类] 添加gaode control", id: L7DemoConst.MAP_ADD_CONTROL_WITH_GAODE},
    ])

    const toggleDemo = (menu: menu) => {
        switch (menu.id) {
            case l7DemoConst.MAP_INIT_MAPBOX:
                openWindow(router, "l7InitMap", {id: "mapbox"})
                break;
            case l7DemoConst.MAP_INIT_GAODE:
                openWindow(router, "l7InitMap", {id: "gaode"})
                break;
            case l7DemoConst.MAP_ADD_MARKER:
                openWindow(router, "l7AddMark")
                break;
            case l7DemoConst.MAP_ADD_BUBBLE_1:
                openWindow(router, "l7AddBubble1")
                break;
            case l7DemoConst.MAP_ADD_BUBBLE_2:
                openWindow(router, "l7AddBubble2")
                break;
            case l7DemoConst.MAP_ADD_BUBBLE_3:
                openWindow(router, "l7AddBubble3")
                break;
            case l7DemoConst.MAP_ADD_BUBBLE_4:
                openWindow(router, "l7AddBubble4")
                break;
            case l7DemoConst.MAP_ADD_TEXT_1:
                openWindow(router, "l7AddText1")
                break;
            case l7DemoConst.MAP_ADD_TEXT_2:
                openWindow(router, "l7AddText2")
                break;
            case l7DemoConst.MAP_ADD_TEXT_3:
                openWindow(router, "l7AddText3")
                break;
            case l7DemoConst.MAP_ADD_TEXT_4:
                openWindow(router, "l7AddText4")
                break;
            case l7DemoConst.MAP_ADD_TEXT_5:
                openWindow(router, "l7AddText5")
                break;
            case l7DemoConst.MAP_ADD_TEXT_6:
                openWindow(router, "l7AddText6")
                break;
            case l7DemoConst.MAP_ADD_SCATTER_1:
                openWindow(router, "l7AddScatter1")
                break;
            case l7DemoConst.MAP_ADD_SCATTER_2:
                openWindow(router, "l7AddScatter2")
                break;
            case l7DemoConst.MAP_ADD_SCATTER_3:
                openWindow(router, "l7AddScatter3")
                break;
            case l7DemoConst.MAP_ADD_SCATTER_4:
                openWindow(router, "l7AddScatter4")
                break;
            case l7DemoConst.MAP_ADD_SCATTER_5:
                openWindow(router, "l7AddScatter5")
                break;
            case l7DemoConst.MAP_ADD_SCATTER_6:
                openWindow(router, "l7AddScatter6")
                break;
            case l7DemoConst.MAP_ADD_CONTROL_WITH_MAPBOX:
                openWindow(router, "l7AddControlWithMapbox")
                break;
            case l7DemoConst.MAP_ADD_CONTROL_WITH_GAODE:
                openWindow(router, "l7AddControlWithGaode")
                break;
            case l7DemoConst.MAP_ADD_LAYER:
                openWindow(router, "l7AddLayer")
                break;
        }
    }

    return {
        demoList, toggleDemo
    }
}
